<?php
/**
 * Created by PhpStorm.
 * User: User
 * Date: 2017/9/20
 * Time: 9:07
 */

$num1=$_GET["t1"];
$num2=$_GET["t2"];
$s1=$_GET["si"];
switch ($s1){
    case'+':$result=$num1+$num2;break;
    case'-':$result=$num1+$num2;break;
    case'*':$result=$num1+$num2;break;
    case'/':$result=$num1+$num2;break;
}
?>
<html>
<body>
<form action="cal.php" method="get">
<input type="text" name="t1" value="<?php echo $num1?>"/>
<select name="s1">
    <option value="+" <?php echo $s1=='+'? 'selected':''?>>+</option>
    <option value="-" <?php echo $s1=='-'? 'selected':''?>>-</option>
    <option value="*" <?php echo $s1=='*'? 'selected':''?>>*</option>
    <option value="/" <?php echo $s1=='/'? 'selected':''?>>/</option>
</select>
<input type="text" name="t2" value="<?php echo $num2?>"/>
=
<input type="text" name="t3"/>

<button type="submit" name="b1">计算</button>
</form>
</body>
</html>
